# Moths - an environment for mathy calculations
# Copyright (C) 2006 Mike Sutjipto
# Licensed under the GPL

module Moths
  
  # Basically a sort of abstract class that every expression
  # must (well... should) subclass/implement.  These are the critical
  # functions for expression evaluation
  #
  class Expression
    @precedence

    attr_reader :precedence

    # Returns a nicely formatted string representation of the expression
    #
    def to_s
      raise RuntimeError, 'to_s not implemented!'
    end

    # Perform whatever steps are necessary to evaluate this expression
    #
    def eval(env)
      raise RuntimeError, 'eval not implemented!'
    end
  end
  
end
